package com.action;


import cn.hutool.core.io.FileUtil;
import com.bean.ResponseBean2;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class RegistAction {

    @Value("${upload.tmp.dir}")
    private String tmp;

    @Value("${upload.dir}")
    private  String upload;

    @RequestMapping("/regist")
    public ResponseBean2 regist(String name,String filename){
        System.out.println(name);
        System.out.println(filename);
        //1.写数据库
        //2.把文件从tmp目录复制upload目录
        FileUtil.copy(tmp+filename,upload,true);

        return new ResponseBean2(200,"注册成功",null);
    }
}
